import React, { useState } from "react";
import { Navigate, NavLink, Outlet } from "react-router-dom";
export default function Home() {
  // const [sum, setSum] = useState(1);

  return (
    // <div>
    //   <h3>Home</h3>
    //   {sum === 2 ? <Navigate to="/about" /> : <h4>当前sum的值：{sum}</h4>}
    //   <button onClick={() => setSum(2)}>点我sum变成2</button>
    // </div>

    <div>
      <h2>Home组件</h2>
      <ul>
        <li>
          <NavLink to="news">News</NavLink>
        </li>
        <li>
          <NavLink to="message">Message</NavLink>
        </li>
      </ul>
      {/* 指定路由组件呈现位置 */}
      <Outlet/>
    </div>
  );
}
